package com.ioc.common.content;

/**
 * 加密和解密参数：配置
 *
 * @author ONEC
 */
public class AesEntityContent {

    // 读取数据：name : 盐值不能和字段名相同，会增加别名导致读取数据为空：此盐值一旦确定不可更改
    // CAST （）解决中文乱码：UNHEX（） 16进制转换： HEX（） 转为16进制： AES_DECRYPT（） mysql 解密：AES_ENCRYPT（）加密：
    public static final String AES_DECRYPT_NAME = "CAST(AES_DECRYPT(UNHEX(name),'SALT000001')as char(128))";
    public static final String AES_ENCRYPT_NAME = "HEX(AES_ENCRYPT(?, 'SALT000001'))";
    // 读取数据：PHONE
    public static final String AES_DECRYPT_PHONE = "AES_DECRYPT(UNHEX(phone),'SALT000001')";
    public static final String AES_ENCRYPT_PHONE = "HEX(AES_ENCRYPT(?, 'SALT000001'))";
    // 读取数据：ID_CARD
    public static final String AES_DECRYPT_ID_CARD = "AES_DECRYPT(UNHEX(id_card),'SALT000001')";
    public static final String AES_ENCRYPT_ID_CARD = "HEX(AES_ENCRYPT(?, 'SALT000001'))";
    // 读取数据：CARD_NO
    public static final String AES_DECRYPT_CARD_NO = "AES_DECRYPT(UNHEX(card_no),'SALT000001')";
    public static final String AES_ENCRYPT_CARD_NO = "HEX(AES_ENCRYPT(?, 'SALT000001'))";

    // 读取数据：CVV
    public static final String AES_DECRYPT_CVV = "AES_DECRYPT(UNHEX(cvv),'SALT000001')";
    public static final String AES_ENCRYPT_CVV = "HEX(AES_ENCRYPT(?, 'SALT000001'))";
    // 读取数据：CVV
    public static final String AES_DECRYPT_EXPIRED = "AES_DECRYPT(UNHEX(expired),'SALT000001')";
    public static final String AES_ENCRYPT_EXPIRED = "HEX(AES_ENCRYPT(?, 'SALT000001'))";
}
